<table>
  <tr>
    <th>Questionnaire</th>
    <th>Last event</th>
    <th>Youth ID</th>
  </tr>


  <% @questionnaires.each do |q| %>
    <tr class="<%= get_next_result_set_type %>">
      <td><%= check_box_tag("quest_ids[]", q.id) %> <%= link_to q.questionnaire_name.name, :controller => 'questionnaire', :action => 'edit', :id => q.id %></td>

      <td>
        <% if q.questionnaire_events.size > 0 %>
          <%= q.questionnaire_events.last.questionnaire_event_type.name %>
          <%= q.questionnaire_events.last.comment.empty? ? "" : "(" + q.questionnaire_events.last.comment + ")" %>
        <% end %>
      </td>
      <td><%= link_to sprintf("%04x", q.data_collection.youth_id), :controller => 'youth', :action => 'edit', :id => q.data_collection.youth_id %></td>
    </tr>
  <% end %>
</table>

